<?php
$exmatname = $_POST['newname'];
$allhtml = $_POST['allhtml'];
$exmatid = $_POST['nowid'];
$justbill = $_POST['justbill'];
require('../../cofd/common.php');
$mysqli = $conn;
$justbill = preg_replace('/\s+/', '', $justbill);
if($exmatname == 'not'){
    $stmt = $mysqli->prepare("UPDATE exam_page SET exmattm = ?,exmatanse = ? WHERE exmatid = ?");
    $stmt->bind_param('sss', $allhtml,$justbill, $exmatid); 
}else{
    $stmt = $mysqli->prepare("UPDATE exam_page SET exmattm = ?, exmatname = ?,exmatanse = ?  WHERE exmatid = ?");
    $stmt->bind_param('ssss', $allhtml,$exmatname,$justbill, $exmatid); 
}
if($stmt->execute()){
    echo json_encode(array('status' => 200));
}else{
    echo json_encode(array('status' => 500));
}
$stmt->close();
$mysqli->close();